/* $Header: status.c,v 2.2 01/10/02 10:28:21 przybyls Exp $ */

/***********************************************************************/
/*                                                                     */
/*                  Copyright Hewlett-Packard Co. 1991                 */
/*                                                                     */
/***********************************************************************/

/***********************************************************************/
/* MODULE NAME:  status.c                                              */
/* ============                                                        */
/*                                                                     */
/* Author:  Rick Wikfors, Lesley Freed,                                */
/*                                                                     */
/* MODULE PURPOSE:  To allocate variable storage for all of the        */
/*                  data in the Instrument Status store.               */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/***********************************************************************/


/*****************************/
/*   GLOBAL INCLUDE FILES    */
/*****************************/


/*****************************/
/*   LOCAL INCLUDE FILES     */
/*****************************/

#include <typedefs.h>
#include <p_wkfile.h>
#include <wkfile.h>
#include <p_status.h>
#include <ramps.h>
#include <zone_config.h>
#include <zone_status.h>
#include <status.h>
#include <sig_types.h>
#include <dig_path.h>
#include <pcb_defs.h>
#include <meth_config.h>

/*****************************/
/*   GLOBAL VARIABLES        */
/*****************************/

/***************** POWER FAIL PROTECTED RAM ALLOCATION *****************/


/* Start Address of Protected RAM. NOTE!! The PF_Start and    */
/*  PF_End check words are in separate sections so we can be  */
/*  sure that they surround the pfail section.  The C compiler*/
/*  doesn't always preserve the order in which data is        */
/*  declared!  Memory is zeroed after PF_End in a normal      */
/*  power fail recovery system boot.                          */

/*  The MF_Start check word and mfstart, manuf Sections were  */
/*  added for things like the serial#, manufacturing date,    */
/*  and oven configuration (fast/normal).  They are preserved */
/* when the memory is reset due to a software version change  */
/*  (V.U.F), and reset if any of the check words are corrupt. */

#pragma SECTION UDATA=mfstart

    U_INT16 MF_Start;

    /* Start address of manufacturing variables, see above section comment! */

#pragma SECTION UNDO

#pragma SECTION UDATA=pfstart

    U_INT16 PF_Start;

    /* Start address of protected variables, see above section comment! */

#pragma SECTION UNDO

#pragma SECTION UDATA=pfend

    U_INT16 PF_End;

#pragma SECTION UNDO

#pragma SECTION UDATA=methpool

    U_INT16 Meth_Start;

#pragma SECTION UNDO


#pragma SECTION UDATA=manuf

    SERIAL_NO  Serial_No;
    DATETIME   When_Manufactured;
    U_INT32    Uptime_Clock;          /* cumulative power-on time in seconds  */
    U_INT32    Run_Count;
    OVEN_TYPE  Oven_Type;

    U_INT16 Scratch_Length;           /* calculated length of present mfg RAM in bytes      */
    U_INT16 MF_Length;                /* length of manufacturing RAM (past MF_End) in bytes */

    DET_CONFIG DetectorA_Config;
    DET_CONFIG DetectorB_Config;

    AUX_ZONE_CONFIG  Auxa_Config;     /* overall config. for aux 1 temp zone */
    AUX_ZONE_CONFIG  Auxb_Config;     /* overall config. for aux 2 temp zone */

/* LAN IP Address */
   IP_ADDRESS_TYPE   IP_Address;
   IP_ADDRESS_TYPE   Subnet;
   IP_ADDRESS_TYPE   Gateway;
   BIT8              LAN_bootp_mode;
   U_INT16           Timeout;

#pragma SECTION UNDO

#pragma SECTION UDATA=mfend

    U_INT16    MF_End;                /* pre-Seaquest end of manuf ram marker */

#pragma SECTION UNDO


#pragma SECTION UDATA=manuf2

/* this section unused for now */

#pragma SECTION UNDO

#pragma SECTION UDATA=mfendend

    U_INT16 MF_End2;          /* second flag - contents should be same as MF_End    */

#pragma SECTION UNDO

#pragma SECTION UDATA=pfail

/* Debug stuff for watchdog timeout problem */
    INT32     Ioff_Address;
    INT32     Last_Ioff_Address;
    U_INT8    Interrupt_Level;
    U_INT8    Last_Interrupt_Level;
    U_INT8    I_Cnt;
    U_INT8    Last_I_Cnt;

/* Flags indicating state of the instrument.              */

    RUN_TYPE  Run_State;        /* RUN_IDLE, PRE_RUN, RUN_ACTIVE, or POST_RUN */
    BIT8      Blank_Run;        /* true if a blank run is in progress */
    INT8      PF_Recovery_State;/* 0 - 3 indicator for datacomm of seqtask restart state */
    BIT8      Scc_Run;          /* true if an SCC run is in progress */
    BIT8      Pre_Run_Ready;    /* true while (Run_State == PRE_RUN) after InternalReadyForPreRun() */
    BIT8      Power_Fail_Blank_Run;  /* true for blank run at power on */
    BIT8      PF_Check_Area_Valid;   /* flag used to preserve old instrument configuration through repetitive powerfails */
    BIT8      Method_Dirty;
    BIT8      Hidden_Method_Dirty;

    PARAM_MOD_TYPE  Parameter_Modified[2];
    PARAM_MOD_TYPE2 Parameter_Modified2[2];

    SIG_RUN_STATE Scc_Run_State;
    BIT8          Scc_Start_Pending;
    CCOMP_DATA    Ccomp1_Data;    /* Column Compensation States           */
    CCOMP_DATA    Ccomp2_Data;
    CCOMP_DATA    Test_Plot_Data;
    CCOMP_DATA    Test_Signal_Data;

    INT8          Current_Method;

    INT32         Service_Count[8];

                                   /* Column Compensation Profiles         */
    PROFILE Ccomp1_Profile;
    PROFILE Ccomp2_Profile;

    BIT8     Skip_Power_On_Test;
    BIT8     Oven_Power_On_Test;  /* flag to execute the oven power test at power-on */
    U_INT8   Oven_Test_On_Time;   /* on time duration for powering the oven  */
                                  /* heater during the oven power on test    */
    U_INT8   Oven_Test_Off_Time;  /* off time duration for powering the oven */
                                  /* heater during the oven power on test    */

    ON_OFF   Disable_Diag_Auto_Clear; /* flag to clear diagnostics on exiting */
                                      /* the diagnostics section of the keybd.*/

    GCCW     gccw;                /* Instrument config - must protect from power fail during turn on */







                 /* -----------       begin critical code     ----------------  */


                       /*  begin prep for xxName[] declarations */

    U_INT16 DetSerial[MAX_DETECTORS];      /* detector serial interface setpoints (DAC units) */
    INT32   DetUserSerial[MAX_DETECTORS];  /* detector serial interface setpoints (user units) */
                                           /*                                                  */
                                           /* These or other system types that force ALIGN_2   */
                                           /*  or ALIGN_4 activity must IMMEDIATELY preceed    */
                                           /*  the xxName[n] section that follows !!! This     */
                                           /*  is the "prep" that the comments referr to .     */
                                           /*                                                  */

                       /*  end prep for xxName[] declarations   */





/* Channel Partner Friendly / OEM info */

/*
 *  WARNINGS:
 *        1/ "xxName[n]" char string arrays must begin on word boundaries since
 *           they are written 16 bits at a time in the p_init.c table driven 6890 initializer !!!!!!
 *
 *           To ensure this:
 *              1/All CPF/OEM Name[] arrays are declared here together AND
 *              2/ The "extern" records in status.h that declare all vars in this critical code
 *                 area must appear in status.h in the same order as the defining references do here.
 *              3/ The "prep" variables (or some integer(s) or long(s) ) must appear here and in status.h
 *                 as they are presently done.
 *
 *        2/ If "gccw checkable" ( i.e. instrument configuration ) gases or labels are added/deleted
 *           from the OEM_DET model, then OEM_DET_MODE_CFG_CNT & OEM_DET_LABEL_CFG_CNT  must ALSO!! be chgd !!
 *
 */

        /* names  */
/*      U_INT16       FIThermal[6];  never used; proc p_init/GetEepromCPFThermal avoids them !! */
        BIT8          FIName[8];    /* need only [7] but use [8] to force ALIGN_2 equivaqlency in emitted code */
/*      U_INT16       BIThermal[6];  never used; proc p_init/GetEepromCPFThermal avoids them !! */
        BIT8          BIName[8];    /* need only [7] but use [8] to force ALIGN_2 equivaqlency in emitted code */
        BIT8          FDName[8];    /* need only [7] but use [8] to force ALIGN_2 equivaqlency in emitted code */
        BIT8          BDName[8];    /* need only [7] but use [8] to force ALIGN_2 equivaqlency in emitted code */
        BIT8          GCName[21];



                 /* -----------         end critical code       --------------- */

        BIT8          OEMPollTym[2];    /* Front,Back det */

        /* front detector */
/*      U_INT16       FDThermal[6];  never used; proc p_init/GetEepromCPFThermal avoids them !! */

        BIT8          FDCPF;

        CPF_GAS_TYPE  FDGas1;       /* included in OEM_DET_MODE_CFG_CNT ; see det_tbls.c */
        CPF_GAS_TYPE  FDGas2;       /* included in OEM_DET_MODE_CFG_CNT ; see det_tbls.c */
        CPF_GAS_TYPE  FDGas3;       /* included in OEM_DET_MODE_CFG_CNT ; see det_tbls.c */

        CPF_CTL_TYPE  FDCtl1;       /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        CPF_CTL_TYPE  FDCtl2;       /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        CPF_CTL_TYPE  FDCtl3;       /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        CPF_CTL_TYPE  FDCtl4;       /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */

        OEM_CTRL_TYPE  FDCtrl5;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        OEM_XTRL_TYPE  FDXtrl6;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        OEM_XTRL_TYPE  FDXtrl7;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */

        /* ctrl8 place holder */    /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */

        OEM_DIAG_TYPE  FDDiag1;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        OEM_DIAG_TYPE  FDDiag2;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */

        /* back detector */
/*      U_INT16       BDThermal[6];  never used; proc p_init/GetEepromCPFThermal avoids them !! */

        BIT8          BDCPF;

        CPF_GAS_TYPE  BDGas1;       /* included in OEM_DET_MODE_CFG_CNT ; see det_tbls.c */
        CPF_GAS_TYPE  BDGas2;       /* included in OEM_DET_MODE_CFG_CNT ; see det_tbls.c */
        CPF_GAS_TYPE  BDGas3;       /* included in OEM_DET_MODE_CFG_CNT ; see det_tbls.c */

        CPF_CTL_TYPE  BDCtl1;       /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        CPF_CTL_TYPE  BDCtl2;       /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        CPF_CTL_TYPE  BDCtl3;       /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        CPF_CTL_TYPE  BDCtl4;       /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */

        OEM_CTRL_TYPE  BDCtrl5;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        OEM_XTRL_TYPE  BDXtrl6;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        OEM_XTRL_TYPE  BDXtrl7;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */

        /* ctrl8 place holder */    /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */

        OEM_DIAG_TYPE  BDDiag1;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */
        OEM_DIAG_TYPE  BDDiag2;     /* included in OEM_DET_LABEL_CFG_CNT ; see det_tbls.c */

        U_INT16        OEMDetFritFlags[2][3];
                                    /* bitpacked per gas_type; "1"=> maxflow <> 0         */
                                    /*  If "1" then in flow_mode for that gas             */
                                    /*  If "0" then in pres_mode for that gas             */
                                    /*  if all 16 bits = 1, gas channel invalid or ignord */

/* present info for CPF's OIM board */
       BIT8      OIMPresence[MAX_DETECTORS];

/* flash programming info */
       FLASH_DATA_TYPE Flash_Data;

#pragma SECTION UNDO

/***************** END POWER FAIL PROTECTED RAM ALLOCATION *************/

    INT32          Run_Clock;

    BIT8   Start_Run_Lock;
    BIT8   Seq_Run_Lock_Copy;
    BIT8   Remote_Start_Lock;
    BIT8   Controlled_By_Host;
    BIT8   Start_Run_Pending;
    BIT8   Stop_Run_Pending;
    BIT8   Run_Requested;
    BIT8   Run_Task_Running;
    BIT8   Ramps_Executed;   /* flag that the ramp generator has run */


    BIT8   Initialization_Complete;
    BIT8   Zone_Power_On_Complete;
    BIT8   Power_On_Test_Complete;
    BIT8   Offset_Measurement_Complete;
    BIT8   Oven_Holdoff;
    BIT8   Stop_Key_Pressed;
    RECOVERY_STATE Recovery_State;

    INST_STATUS Inst_Status;

    ATMOSPHERIC_PRESSURE Atmospheric_Pressure;

    /* Power-On, Test, and Workfile Installation results */

    U_INT8  PF_Reset;
    U_INT8  MF_Reset;
    BIT8    Det_DSP_Startup_Status;   /* results of sig dsp poweron selftest  */
    BIT8    Det_DSP_Status;           /* signal DSP status register           */
    BIT8    Pneu_FPGA_Status;         /* pneumatics FPGA load results         */
    U_INT16 Pneu_Dsp_Startup_Status;  /* results of pneu dsp poweron selftest */
    U_INT8 Mux_Adc_Status;
    DIAG_RESULT Duart_Power_On_Status; /* results of DuartPowerOnTest() */
    BIT8   DataComm_Power_On_Complete; /* all datacomm is ready for comm */

    /* boolean for whether or not these were true for the last power-on */
    BIT8     Skip_Power_On_Test_Executed;
    BIT8     Oven_Power_On_Test_Executed;

/* Detector DSP Data Tranfer Storage            */

        DSP_IN  Dsp_In;
        DSP_OUT Dsp_Out;

        INT32   Deta_Data;
        INT32   Detb_Data;

/* Hardware discrete ouput latch images */
        BIT8    DiscreteOut1_Image;
        BIT8    DiscreteOut1_Diag;      /* diagnostics mode */
        BIT8    DiscreteOut2_Image;     /* normal operation */
        BIT8    DiscreteOut2_Diag;      /* diagnostics mode */
        BIT8    Detector_Adc_Image;

/* Hardware RESET Register Images */

        BIT8 Reset1_Image;

/* Keyboard and LED register images */
        BIT8    Rows_LED1_Image;
        BIT8    LED1_Image;             /* Image of LED1 On/OFF control       */
        BIT8    LED2_Image;
        BIT8    LED1_Blink_Image;       /* Image of LED1 Blink control        */
        BIT8    LED2_Blink_Image;       /* Image of LED2 Blink control        */

/* Hardware Register Images */
        BIT8    Valve_Power_Image;      /* RAM image of settings of */
                                        /* oven, zone, valve relays */
                                        /* and valve drive bits for */
                                        /* ZONES_OUT1               */

        BIT8    Zones_Image;            /* RAM image of settings of */
                                        /* oven and zone drive bits */
                                        /* for ZONES_OUT2           */

        BIT8    Zones3_Image;           /* ZONES_OUT3 Image:        */
                                        /* Thermal Fault Bit, Inlet */
                                        /* Cryo/split valve control,*/
                                        /* 24V out                  */

        BIT8    Zones4_Image;           /* ZONES_OUT4 Image:        */
                                        /* inlet fan, flap motor    */

        BIT8    Flap_Drive_Image;       /* Part of ZONES_OUT4:  Flap Motor   */

/* Mux'ed ADC Readings                          */

        /* Temperature Readings */

        IIR_FILT_INFO Mux_Adc_Offset_Rdg;

        IIR_FILT_INFO Mux_Adc_Offset2_Rdg;

        LINE_SENSE    Line_Sense;

        /* Diagnostic Readings */

        U_INT16 FDDiag1Fltr; /* for OEM det kybd & host comm functions */
        U_INT16 FDDiag2Fltr; /* for OEM det kybd & host comm functions */
        U_INT16 BDDiag1Fltr; /* for OEM det kybd & host comm functions */
        U_INT16 BDDiag2Fltr; /* for OEM det kybd & host comm functions */

        BIT8          OEMPollCount[2];
        U_INT16       OEMPollValue[2];
        U_INT16       OEMPollState; /* rdy poll info for BOTH F & B dets packed here */

/*
 *  OEMPollState[n] = U_INT16 with bits used as follows:
 *     = U_INT16 with bits used as follows:
 *
 *     = 0|0|0|0| Fr  | Fr  | Bk  | Bk  | Fr  | Bk  | Fr  | Fr  | Bk  | Bk  | Fr  | Bk  |
 *       0|0|0|0|Save |Skip |Save |Skip | Req | Req |Save |Skip |Save |Skip | Req | Req |
 *       0|0|0|0|Rdy 2|Act 2|Rdy 2|Act 2|  2  |  2  |Rdy 1|Act 1|Rdy 1|Act 1|  1  |  1  |
 *
 *  where "0" = not used ; must be set to zero
 *
 *           x = Fr OR Bk (Front Det OR Back Det )
 *
 *           N = 1 or 2 for nth or n+1 call to StupidValveDetectorTransfer
 *
 *      x_ReqN = flag causing StupidValveDetectorTransfer to issue a ready poll request to det "x" in it's nth
 *               call to StupidValveDetectorTransfer
 *
 *  xSaveRdyN  = flag causing StupidValveDetectorTransfer to store the ready poll result from det "x" in it's
 *               nth call
 *
 *  xSkipActN  = flag causing StupidValveDetectorTransfer to skip storing the actual reading from det "x" in it's
 *               nth  call
 *
 *  Note that each call to StupidValveDetectorTransfer consumes the bits in OEMPollState by RIGHT SHIFTING OEMPollState
 *  one bit as each flag is evaluated.  Assuming bkd is NOT writing to OEMPollState, after 2 calls to
 *  StupidValveDetectorTransfer OEMPollState will be 0x0000 .  Bkd initiates a poll cycle by writing to OEMPollState
 *  as follows:
 *    0x0c12 => poll the FRNT oem det for ready info
 *    0x0305 => poll the BACK oem det for ready info
 *    0x0f17 => poll BOTH dets        for ready info
 *
 */

        U_INT16 Oven_Rdg;
        U_INT16 InjA_Rdg;
        U_INT16 InjB_Rdg;
        U_INT16 DetA_Rdg;
        U_INT16 DetB_Rdg;
        U_INT16 AuxA_Rdg;
        U_INT16 AuxB_Rdg;
        U_INT16 Line_Sense_Rdg;
        U_INT16 Gain_Offset_Rdg;
        U_INT16 Adc_Offset_Rdg;
        U_INT16 Det_Diaga_Rdg;
        U_INT16 Det_Diagb_Rdg;
        U_INT16 Det_Diagc_Rdg;
        U_INT16 Det_Diagd_Rdg;
        U_INT16 Spare1_Rdg;
        U_INT16 Spare2_Rdg;
        U_INT16 Attn1_Rdg;
        U_INT16 Attn2_Rdg;
        U_INT16 DAC1_Rdg;
        U_INT16 DAC2_Rdg;
        U_INT16 Mon_5V_Rdg;
        U_INT16 Mon_24V_Rdg;
        U_INT16 Mon_15Vpos_Rdg;
        U_INT16 Mon_15Vneg_Rdg;
        U_INT16 Pneu_24V_Rdg;

        U_INT32 Ambient_Temp;           /* ambient temperature */

        BIT8 DetaDiagLinearMode;        /* is DSP mode forced to LINEAR? */
        BIT8 DetbDiagLinearMode;        /* is DSP mode forced to LINEAR? */
        BIT8 Det_Diag_Mode;             /* are det discrete outputs being modified in diag mode? */

/* Status for the Signal Path */

        U_INT8    Attn_Start_Tick_Count;/* Start tick count for attenuator    */

        SIG_STATE       Sig_State;      /* Signal Path Processing State       */

        SIG_TABLE Signal1;            /* Working Copies of Setpts and Status  */
        SIG_TABLE Signal2;
        SIG_TABLE SignalP;
        SIG_TABLE *pSignal;           /* Pointer to Working Setpts and Status */

        CCOMP_TABLE Ccomp1;           /* Working Copies of Setpts and Status  */
        CCOMP_TABLE Ccomp2;
        CCOMP_TABLE Test_Plot;
        CCOMP_TABLE Test_Signal;

        U_INT16     Analog_Err_Count; /* Counter used to keep single error from issuing warning */

/* Status for Digital Signal Path */
       U_INT32 SigBuf_Point_Count[NUM_SIGNALS]; /* # pts in main data buffer */
       U_INT16 SigBuf_Overflow[NUM_SIGNALS];    /* flag - main buf overflow */
       U_INT16 FrmtBuf_Point_Count[NUM_SIGNALS];/* # pts in formated data buf */
       U_INT16 Acq_On[NUM_SIGNALS];             /* flag - acquisition on */

/* Status for Mux'ed ADC */

        MUX_ADC_INFO    Mux_Adc_Offset;             /* Signed ADC offset */

/* Thermal status for Oven and Zones */

        ZONE_STATUS     Zone_Status;    /* Overall oven and zone status */
        FLAP_STATUS     Flap_Status;

        CRYO_STATUS     Oven_Cryo_Status;
        CRYO_STATUS     Inja_Cryo_Status;
        CRYO_STATUS     Injb_Cryo_Status;
        CRYO_STATUS     Auxa_Cryo_Status;
        CRYO_STATUS     Auxb_Cryo_Status;


        ZONE_TABLE      *pZone_Table;   /* ptr to zone being processed */

        ZONE_TABLE      Oven_Table;     /* Individual thermal zone status */
        ZONE_TABLE      Deta_Table;
        ZONE_TABLE      Detb_Table;
        ZONE_TABLE      Inja_Table;
        ZONE_TABLE      Injb_Table;
        ZONE_TABLE      Auxa_Table;
        ZONE_TABLE      Auxb_Table;

        /* The following variables are used for thermal zone tuning */

        ZONE_TABLE      *pZone_Tune;    /* ptr to zone being tuned */
        U_INT16         Zone_Msg_No;
        IIR_FILT_INFO   Demand;
        IIR_FILT_INFO   Raw_Demand;
        INT32           Prop_Demand;
        INT32           Deriv_Demand;
        INT32           Integ_Demand;
        U_INT8          Integ_Delay;
        INT32           Dev;

/* Keyboard display variables */

DISP_IMAGE Disp_Image;

 /* status monitor - foreground communication flag */

        BIT8 Check_For_Dead_Pcb;

/* BCD input */

        U_INT8         BCD_Input;
        BIT8           Skip_Multi_Setpt;   /* for sequence method load */

/* Channel Partner Friendly info */

/* working copy of CPF's OIM control lines */
       DET_CPF_CTL  DetCpfCtl[MAX_DETECTORS];

/* input from CPF's OIM board */
       U_INT16      FDetSerialIn;
       U_INT16      BDetSerialIn;

/* Plasma status of LDID detectors */
       ON_OFF       F_LDID_Plasma;
       ON_OFF       B_LDID_Plasma;

/* info on Lantronix LAN interface card */
   BIT8             LAN_MAC_address[20];
   BIT8             LAN_serial_number[20];
   BIT8             LAN_software_version[20];

/* HSS status info */
   U_INT16          HS_Vial_Not_Found;


/*****************************/
/*   EXTERNAL VARIABLES      */
/*****************************/


/*****************************/
/*   LOCAL DEFINES           */
/*****************************/


/*****************************/
/*   STATIC VARIABLES        */
/*****************************/


/*****************************/
/*   IMPLEMENT SECTION       */
/*****************************/

